This README lists the R files and data needed to replicate the figures and tables in the main text and supporting information of "How Sudden Censorship Can Increase Access to Information".

Some data cannot be provided in raw form due to privacy concerns and other data-sharing issues. In those cases, we have provided the code needed to collect the data, as well as aggregate data to replicate the findings reported in the paper.

Please contact the authors with any questions. We're happy to answer questions and we appreciate others double-checking the work.

File structure:
./code/
./data/
./figs/

CODE -- to produce results in paper

instagram_user_count_drop.R
twitter_user_count_jump.R
app_annie_downloads.R
twitter_follower_count_increase.R
plot_wikipedia_views.R
twitter_liu_xiaobo_mentions.R
compare_twitter_weibo_locations.R
compare_twitter_weibo_text.R
sample_instagram_by_population.R
sample_instagram_hk.R
sample_first_tweets.R
plot_hk_mentions.R

DATA

    latitude_longitude_population_agg_china_hk_only.RData
    : format_population_grid.R

    ChinaHKInstagramData_part_fixed.tsv.gz
    : sample_instagram_by_population.R

    HongKongInstagramCounts.csv
    HongKongInstagramCounts_extended.csv
    : sample_instagram_hk.R

    CHNInstagramData_part_fixed_dedup.tsv
    : produced by instagram_user_count_drop.R
    : derived from ChinaHKInstagramData_part_fixed.tsv.gz, latitude_longitude_population_agg_china_hk_only.RData

    CN_2014-01-01_2015-12-31_short.RData
    HK_2014-01-01_2015-12-31_short.RData
    : based on hourly request for worldwide geo-located tweets, subset to mainland China and HK
    : (please contact for further details)

    TwitterWeiboText.csv
    : segmented data that includes 2,416 geo-located Weibo posts and 2,416 geo-located Twitter posts from the Beijing area for comparison

    TwitterAppAnnieData_WebPlotDigitizer.csv
    FacebookAppAnnieData_WebPlotDigitizer.csv
    VPNArtifact_WebPlotDigitizer.csv
    VPNExpressAppAnnieData_WebPlotDigitizer.csv
    : downloaded from AppAnnie.com

    follower_counts_by_date.RData
    : (please contact for further details)

    FirstTweetsForRA.csv
    FirstTweetsForRA_regresume.csv
    : sample_first_tweets.R

    all_zh_blocked_page_counts.RData
    : derived from all_blocked_wikipedia_pages.csv and page counts from Wikipedia

FIGURES

Main text

- Figure 1: The Instagram block's effect on the number of unique Instagram users geo-locating from mainland China.
    : instagram_user_count_drop.R (InstagramPlot.pdf)

- Figure 2:
    Left: Proportion of Tweets from China mentioning 'ins' by day.
    : twitter_user_count_jump.R (UserEffects.pdf)
    Right: The Instagram block's effect on the rank of VPN applications on iPhones from mainland China, from AppAnnie.com.
    : app_annie_downloads.R (AppAnnieArtifactAndExpress.pdf)

- Figure 3:
    Left: The Instagram block's effect on the rank of Facebook and Twitter on iPhones from mainland China, from AppAnnie.com.
    : app_annie_downloads.R (AppAnnieTwitterAndFacebook.pdf)
    Right: Comparison of tweets per day from Mainland China and Hong Kong before and after the Instagram block.
    : twitter_user_count_jump.R (DiffandDiffTwitter.pdf)

- Figure 4:
    Left: Daily new followers to New York Times Chinese and Apple Daily Twitter accounts (based on new user sign-up dates).
    Right: Cumulative increase in followers, compared to pre-block trend, of any Chinese language user (based on new user sign-up dates) compared to expected increase in followers.
    : twitter_follower_count_increase.R (spike_increase_instagram_on_twitter_marginal_examples.pdf, spike_increase_instagram_on_twitter_cumulative.pdf)

- Figure 5 (figures only):
    Left: Tweets that mention politics in Hong Kong, comparison of new users and old users.
    : plot_hk_mentions.R (plot_hk_mentions.pdf)
    Right: Page views for Chinese language Wikipedia pages blocked in China.
    : plot_wikipedia_views.R (blocked_zh_wikipedia_page_views_r_and_r.pdf)

- Figure 6: Instagram block post-mortem: Did the effects persist?
    : twitter_liu_xiaobo_mentions.R (insta_liu_xiaobo.pdf)

Supporting information
- Figure 7: The Instagram block's effect on the number of unique Instagram users geo-locating from mainland China and Hong Kong.
    : instagram_user_count_drop.R (InstagramPlot_CN_v_HK.pdf)

- Figure 8: iPhone download rank in China, VPN Express, 2014-2015. Source: AppAnnie
    : see replications materials for Roberts 2018 (VPNExpressLongTerm.pdf)

- Figure 9: Geo-located Weibo users (left) and Chinese language Twitter users (right) in Beijing and surrounding areas during September 2014.
    : compare_twitter_weibo_locations.R (BeijingAreaWeibo2.jpg, BeijingAreaTwitter2.jpg)

- Figure 10: T-tests of pre-block log likes and log comments of users who stay on Instagram after the block and users who left Instagram after the block.
    : instagram_user_count_drop.R (InstagramStayGo.pdf)

- Figure 11: The Instagram block's effect on new account creation Twitter users from mainland China within our sample.
    : twitter_user_count_jump.R (CreatedByDate.pdf)
- Figure 12: Outlier in Wikipedia page view analysis.
    : plot_wikipedia_views.R (blocked_zh_wikipedia_china_country_page_views_r_and_r.pdf)

TABLES
- Table 2: Words most associated with Twitter and Weibo users, mutual information.
    : compare_twitter_weibo_text.R

- Figure 5 (table portion): Bottom: Changes in Wikipedia views.
    : plot_wikipedia_views.R
